package com.example.nuc_ms_beta.revceiver;

import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.example.nuc_ms_beta.R;
import com.example.nuc_ms_beta.app.MyApplication;

import cn.bmob.push.PushConstants;
import cn.bmob.v3.helper.NotificationCompat;

/**
 * Created by bnhc on 17-5-22.
 *
 * Notification When the APP Get get Message Server
 *
 */

public class MyPushMessageReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(PushConstants.ACTION_MESSAGE)) {
            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(MyApplication.context)
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setContentTitle("From Server")
                    .setContentText(intent.getStringExtra("msg"));
            NotificationManager mNotificationManager =
                    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
            mNotificationManager.notify(00, mBuilder.build());
        }
    }
}
